//
//  MSNavigationBar.h
//  OrderingMerchantsSide
//
//  Created by iOS on 2018/9/20.
//  Copyright © 2018年 mls. All rights reserved.
//

#import "MSView.h"

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, MSNavBarType) {
    MSNavBarTypeDefault,                    ///< 白色背景 + 黑色标题
    MSNavBarTypeClear,                      ///< 透明背景 + 白色标题
};

@protocol MSNavigationBarDelegate;
@interface MSNavigationBar : MSView

/** delegate */
@property (nonatomic, weak)     id<MSNavigationBarDelegate> delegate;
/** YES，有返回按钮 */
@property (nonatomic, assign)   BOOL                        hasBackButton;
/** 标题 label */
@property (nonatomic, strong)   UILabel                     *titleLabel;
/** 返回按钮 */
@property (nonatomic, strong)   UIControl                   *leftBarButtonItem;
/** 返回按钮 icon */
@property (nonatomic, strong)   UIImageView                 *leftImageView;
/** 返回按钮文字，默认上级页title */
@property (nonatomic, strong)   UILabel                     *leftTextLabel;
/** 返回按钮图片大小, default(14, 21) */
@property (nonatomic, assign)   CGSize                      leftImageView_size;

/**
 初始化

 @param title 标题
 @param hasBackButton YES 有返回按钮， NO 没有返回按钮
 */
- (instancetype)initWithTitle:(NSString *)title
                hasBackButton:(BOOL)hasBackButton;

/**
 重设导航栏

 @param title 标题
 @param navBarType 导航栏类型
 */
- (void)resetNavBarWithTitle:(NSString *)title
                  navBarType:(MSNavBarType)navBarType;

@end

@protocol MSNavigationBarDelegate <NSObject>

/** 返回上一页，点击“返回”按钮触发 */
- (void)popLastPage;

@end

NS_ASSUME_NONNULL_END

